﻿using System.ComponentModel;
using System;

namespace WickedFlame.VecDraw.Base.mvvm.common
{
    /// <summary>
    /// Base class that implements the INotifyPropertyChanged interface for databinding
    /// </summary>
    public class NotifyPropertyChangedBase : INotifyPropertyChanged, IFocusMover
    {
        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;// = delegate { };

        protected void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        #endregion

        #region IFocusMover Members

        public event EventHandler<MoveFocusEventArgs> MoveFocus;

        public void RaiseMoveFocus(string focusedProperty)
        {
            if (this.MoveFocus != null)
            {
                this.MoveFocus(this, new MoveFocusEventArgs(focusedProperty));
            }
        }

        #endregion
    }
}
